<template>
  <div>
    <el-card>
      <el-row>
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item><a href="#">消息管理</a></el-breadcrumb-item>
          <el-breadcrumb-item>在线消息列表</el-breadcrumb-item>
        </el-breadcrumb>
      </el-row>
      <el-table :data="onlineList" stripe style="width: 100%">
        <el-table-column width="200" label="头像">
          <template slot-scope="scope">
            <img :src="scope.row.avator" alt="" class="avator" />
          </template>
        </el-table-column>
        <el-table-column prop="name" label="姓名" width="200">
        </el-table-column>
        <el-table-column prop="date" label="日期" width="400">
        </el-table-column>
        <el-table-column width="380" label="症状">
          <template slot-scope="scope">
            <el-tag
              v-for="item in scope.row.symptom"
              :key="item"
              :type="item === '发烧' ? 'danger' : 'primagy'"
              >{{ item }}</el-tag
            >
          </template>
        </el-table-column>
        <el-table-column label="在线状态">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.state === '1'" type="success">在线</el-tag>
            <el-tag v-else type="info">离线</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template>
            <el-button type="warning" size="medium">点击回复</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="[100, 200, 300, 400]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="400"
      >
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      onlineList: [
        {
          id: '1',
          avator: '../../assets/img/1.jpg',
          name: '王琦璋',
          date: '2022-05-04 10:20',
          symptom: ['发烧', '咳嗽', '腹泻', '胸闷'],
          state: '1'
        },
        {
          id: '2',
          avator: '../../assets/img/2.jpg',
          name: '王琦璋',
          date: '2022-05-04 10:20',
          symptom: ['发烧', '咳嗽', '腹泻', '胸闷'],
          state: '1'
        },
        {
          id: '3',
          avator: '../../assets/img/3.jpg',
          name: '王琦璋',
          date: '2022-05-04 10:20',
          symptom: ['发烧', '咳嗽', '腹泻', '胸闷'],
          state: '1'
        },
        {
          id: '4',
          avator: '../../assets/img/4.jpg',
          name: '王琦璋',
          date: '2022-05-04 10:20',
          symptom: ['发烧', '咳嗽', '腹泻', '胸闷'],
          state: '0'
        },
        {
          id: '5',
          avator: '../../assets/img/2.jpg',
          name: '王琦璋',
          date: '2022-05-04 10:20',
          symptom: ['发烧', '咳嗽', '腹泻', '胸闷'],
          state: '1'
        },
        {
          id: '6',
          avator: '../../assets/img/4.jpg',
          name: '王琦璋',
          date: '2022-05-04 10:20',
          symptom: ['发烧', '咳嗽', '腹泻', '胸闷'],
          state: '0'
        },
        {
          id: '7',
          avator: '../../assets/img/1.jpg',
          name: '王琦璋',
          date: '2022-05-04 10:20',
          symptom: ['发烧', '咳嗽', '腹泻', '胸闷'],
          state: '1'
        },
        {
          id: '8',
          avator: '../../assets/img/3.jpg',
          name: '王琦璋',
          date: '2022-05-04 10:20',
          symptom: ['发烧', '咳嗽', '腹泻', '胸闷'],
          state: '1'
        }
      ]
    }
  }
}
</script>

<style scoped>
.avator {
  width: 50px;
  height: 50px;
  border: 1px solid lightblue;
}
.el-tag {
  margin: 0 5px;
}
.el-pagination{
  margin-top: 20px;
}
</style>
